package com.zhuzl.stockservice.controller.api;

import com.zhuzl.orderservice.api.stock.StockApi;
import com.zhuzl.stockservice.service.StockInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author JZY001
 */
@RestController
public class RestStorageApi implements StockApi {

    private final StockInfoService stockInfoService;

    @Autowired
    public RestStorageApi(StockInfoService stockInfoService) {
        this.stockInfoService = stockInfoService;
    }

    @Override
    public String decrease(Integer id, Integer count) {
        stockInfoService.decrease(id, count);

        return "OK";
    }
}
